Cacti : Install
2015/06/16 |
Install Cacti to monitor system status.
|
|
[1] | |
[2] | |
[3] | |
[4] | Install Cacti, SNMP. |
# install from EPEL [root@dlp ~]# yum --enablerepo=epel -y install cacti net-snmp net-snmp-utils php-mysql php-snmp rrdtool
|
[5] | Configure SNMP (Simple Network Management Protocol). |
[root@dlp ~]#
vi /etc/snmp/snmpd.conf # line 41: comment out # com2sec notConfigUser default public
# line 74,75: uncomment and change # change "mynetwork" to your own network # change comunity name to anyone except public, private (for security reason) com2sec local localhost Serverworld com2sec mynetwork 10.0.0.0/24 Serverworld # line 78,79: uncomment and change group MyRWGroup v2c localgroup MyROGroup v2c mynetwork# line 85: uncomment view all included .1 80 # line 93,94: uncomment and change access MyROGroup "" v2c noauth exact all none noneaccess MyRWGroup "" v2c noauth exact all all all# validation (replace "Serverworld" to the comunity name you set) [root@dlp ~]# snmpwalk -v2c -c Serverworld localhost system SNMPv2-MIB::sysDescr.0 = STRING: Linux dlp.srv.world 3.10.0-229.4.2.el7.x86_64 #1 SMP Wed May..... SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (91954) 0:15:19.54 SNMPv2-MIB::sysContact.0 = STRING: Root <root@localhost> (configure /etc/snmp ..... ..... SNMPv2-MIB::sysORUpTime.9 = Timeticks: (4) 0:00:00.04 SNMPv2-MIB::sysORUpTime.10 = Timeticks: (4) 0:00:00.04 |
[6] | Create a Database for Cacti and import tables. |
[root@dlp ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3342 Server version: 5.5.41-MariaDB MariaDB Server Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. # create a "Cacti" database ( set any password for 'password' section )
MariaDB [(none)]>
create database cacti; Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]>
grant all privileges on cacti.* to cacti@'localhost' identified by 'password'; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
flush privileges; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
[root@dlp ~]# exit Bye mysql -u cacti -p cacti < /usr/share/doc/cacti-*/cacti.sql Enter password: # cacti user's password |
[7] | Configure Cacti. |
[root@dlp ~]#
vi /etc/cron.d/cacti # uncomment */5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
[root@dlp ~]#
vi /usr/share/cacti/include/config.php # line 29: change to the connection info to MariaDB $database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = " cacti ";$database_password = " password ";$database_port = "3306"; $database_ssl = false;
[root@dlp ~]#
vi /etc/httpd/conf.d/cacti.conf # line 17: add access permission if need Require host localhost
Require ip 10.0.0.0/24
systemctl restart httpd |